DEF xyz:PTR TO objwhere obj is defined in same way as normal OBJECT. This allows You to define OOP functions to all OBJECTs (like Window, IntuiMessage, etc.). These functions must be defined as following:
PROC name(args)(result) OF objwhere name, args and result are defined in same way as normal procedures and obj means, that this function will be attached to OBJECT called obj. If function is attached to an OBJECT, it allows You to use OBJECT's items as normal variables:
OBJECT testobj name[64]:CHAR, count:LONG, weight:DOUBLE PROC SetName(new:PTR TO CHAR) OF testobj StrCopy(name,new) ENDPROC PROC Reset() OF testobj StrCopy(name,'Unnamed') count:=100 weight:=12.3 ENDPROC PROC Total()(DOUBLE) OF testobj IS count*weight PROC main() DEF ob:testobj ob.Reset() ob.SetName('MarK') ob.weight:=78.1 PrintF('Total: \d\n',ob.Total()) ENDPROC